<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="../js/vue.js"></script>
    <title>数据更新时候出现的问题</title>
</head>
<body>
    <div id="app">
        <h1>人员列表</h1>
        <button @click="updataMei">更新马冬梅数据</button>
        <ul>
            <li v-for="p in list" :key='p.id'>
                {{p.name}}-{{p.age}}-{{p.sex}}
            </li>
        </ul>
    </div>

    
    <script>
        Vue.config.productionTip = false
        const vm = new Vue({
            data(){
                return {
                   name:'',
                   list:[
                       {id:'001',name:'马冬梅',age:18,sex:'女'},
                       {id:'002',name:'周冬雨',age:19,sex:'女'},
                       {id:'003',name:'周杰伦',age:20,sex:'女'},
                       {id:'004',name:'郭艾伦',age:21,sex:'男'},
                       {id:'005',name:'温兆伦',age:21,sex:'男'},
                   ],
                }
            },
            methods: {
                updataMei(){
                    // this.list[0].name = '马老师',
                    this.list[0] = {id:'001',name:'马老师',age:18,sex:'男'}
                }
            },
        }).$mount('#app')
    </script>
</body>
</html>